#ifndef L2_CONFIGURATOR_HPP
#define L2_CONFIGURATOR_HPP

#include "L2DataSet.hpp"

#define PORT_MAX_LINE_LENGTH 64

class Configurator : public DataSet {
public:
    class FileAdapter {
    public:
        enum Flag {
            Flag_Read,
            Flag_Write,
        };
    public:
        virtual bool open(int flag) = 0;
        virtual bool close() = 0;
        virtual unsigned int readline(void *buffer) = 0;
        virtual unsigned int writeline(void *buffer) = 0;
    };

    enum ErrorNumber {
        Error_NoFileAdapter = 11,
        Error_FileOpenFailed = 12,
        Error_FileCloseFailed = 13,
        Error_FileWriteError = 14,
    };
public:
    explicit Configurator(FileAdapter *file_adapter);
    virtual ~Configurator();
    virtual bool load(void);
    virtual bool store(void);
public:
    static const char *str_TRUE;
    static const char *str_FALSE;
protected:
    FileAdapter *file_adapter;
};

#endif
